package com.ketangpai.util;

import java.util.Random;

/**
 * @author jiahao
 * @date 2024/2/16 21:20
 */
public class RandomDataGenerator {
    private static final String UPPER_CASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final String DIGITS = "0123456789";
    private static final Random random = new Random();

    public static String generateRandomData(int length) {
        StringBuilder sb = new StringBuilder();
        String source = UPPER_CASE_LETTERS + DIGITS;

        for (int i = 0; i < length; i++) {
            int index = random.nextInt(source.length());
            sb.append(source.charAt(index));
        }

        return sb.toString();
    }
}